import java.util.Scanner;
import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        MyStack myStack = new MyStack();
//        Scanner scanner = new Scanner(System.in);
//        int input =
//        long sum = Math.pow()
        int[] pushV = {1,2,3,4,5};
        int[] popV = {4,5,3,2,1};
        System.out.println(myStack.IsPopOrder(pushV, popV));
        String[] tokens = {"2","1","+","3","*"};
        String s = "()[]{}";
        System.out.println(myStack.isValid(s));
        int ret = myStack.evalRPN(tokens);
        System.out.println(ret);
        myStack.push(10);
        myStack.push(20);
        myStack.push(30);
        myStack.push(40);
        System.out.println("======");
        System.out.println(myStack.peek());
        System.out.println(myStack.peek());
        try {
            System.out.println(myStack.pop());
            System.out.println(myStack.pop());
            System.out.println(myStack.pop());
            System.out.println(myStack.pop());
            System.out.println(myStack.pop());
        }catch (StackEmptyException e){
            e.printStackTrace();
        }





    }
    public static void main1(String[] args) {
        //栈的底层是数组！！链表也可以实现栈
        Stack<Integer> stack = new Stack<>();
        //进栈
        stack.push(10);
        stack.push(20);
        stack.push(30);
        //将元素弹出【删除栈顶元素】
        int x = stack.pop();
        System.out.println(x);

        //获取栈顶元素
        int y = stack.peek();
        System.out.println(y);
        //看看栈空不空
        System.out.println(stack.empty());
    }
}
